import { Dispatch } from "react";
import { DailyWorkAT } from "../action-types";
import { DailyWorkAction } from "../actions";

export const addDailyTask = (task: string) => {
  return (dispatch: Dispatch<DailyWorkAction>) => {
    dispatch({
      type: DailyWorkAT.ADDDAILYTASK,
      task: task,
    });
  };
};

export const removeDailyTask = (index: number) => {
  return (dispatch: Dispatch<DailyWorkAction>) => {
    dispatch({
      type: DailyWorkAT.REMOVEDAILYTASK,
      index: index,
    });
  };
};

export const editDailyTask = (index: number, task: string) => {
  return (dispatch: Dispatch<DailyWorkAction>) => {
    dispatch({
      type: DailyWorkAT.EDITDAILYTASK,
      index: index,
      task: task,
    });
  };
};
